﻿/**
 * @author sminutoli
 */
 
import com.dinmax.flash.draw.cabeza.*
import com.dinmax.flash.central.bridge.CONSOLEBridge
import com.dinmax.flash.central.bridge.DATARootBridge

class com.dinmax.flash.central.bridge.ROOTButtonsBridge
extends ControlCabeza
implements SelectedListener {
	
	private var mcWriteMessage:ButtonCabezaTooltip;
	private var mcMakeCall:ButtonCabezaTooltip;
	private var mcFindPerson:ButtonCabezaTooltip;
	private var mcShortCuts:ButtonCabezaTooltip;
	
	private var mcDATARootBridge:DATARootBridge;
	
	private var bridge:CONSOLEBridge;
	
	public function initChild(control:ControlCabeza):Void {
		control.addListener(this);
		switch(control){
			case mcWriteMessage:
			mcWriteMessage.setToolTipMsg("Enviar Mensaje");
			mcWriteMessage.setToolTipTimer(150);
			break;
			
			case mcMakeCall:
			mcMakeCall.setToolTipMsg("Hacer llamado");
			mcMakeCall.setToolTipTimer(150);
			//mcMakeCall.setDisabled();
			break;
			
			case mcFindPerson:
			mcFindPerson.setToolTipMsg("Buscar");
			mcFindPerson.setToolTipTimer(150);
			break;
			
			case mcShortCuts:
			mcShortCuts.setToolTipMsg("Atajos");
			mcShortCuts.setToolTipTimer(150);
			break;
			
			case mcDATARootBridge:
			//trace("dataroot bridge inicializado");
			break;
		};
		return;
	};
	
	public function selected(control:ControlCabeza):Void {
		switch(control){
			case this.mcWriteMessage:
			this.mcDATARootBridge.display(DATARootBridge.WRITE_MESSAGE);
			//this.getBridge().getBridge().getActive().
			break;
			
			case this.mcMakeCall:
			this.mcDATARootBridge.display(DATARootBridge.MAKE_CALL);
			//this.getBridge().getBridge().getActive().
			break;
			
			case this.mcFindPerson:
			this.mcDATARootBridge.display(DATARootBridge.FIND_PERSON);
			//this.getBridge().getBridge().getActive().
			break;
			
			case this.mcShortCuts:
			this.mcDATARootBridge.display(DATARootBridge.SHORTCUTS);			
			break;
						
		};
		
		return;
	};
	
	public function writeMessage(to:Number):Void {
		this.mcDATARootBridge.setWriteMessageID(to);
		this.selected(this.mcWriteMessage);
		return;
	};
	
	public function getBridge():CONSOLEBridge {
		return bridge;
	}

	public function setBridge(bridge:CONSOLEBridge):Void {
		this.bridge = bridge;
	}
	
	public function getDATARoot():DATARootBridge {
		//trace("ROOTButtonsBridge.as getDATARoot()= "+this.mcDATARootBridge);
		return this.mcDATARootBridge;
	};

}